package com.ucode.model.hrm.form;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;
import java.time.LocalDate;

@Schema(description = "人力资源管理系统 - 员工薪酬Form")
@Data
@EqualsAndHashCode
@ToString(callSuper = true)
public class HrmEmployeeCompensationForm {

    /**
     * 员工编号
     */
    @Schema(description = "员工编号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "员工编号不能为空")
    private Long id;

    /**
     * 银行名称
     */
    @Schema(description = "银行名称", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "银行名称不能为空")
    @Size(max = 100, message = "银行名称不能超过 100 个字符")
    private String bankName;
    /**
     * 银行卡号
     */
    @Schema(description = "银行卡号", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "银行卡号不能为空")
    @Size(max = 50, message = "银行卡号不能超过 50 个字符")
    private String bankCard;
    /**
     * 基本工资（岗位工资）
     */
    @Schema(description = "基本工资", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "基本工资不能为空")
    @Min(value = 0, message = "基本工资最小值为0")
    private BigDecimal baseSalary;
    /**
     * 绩效工资
     */
    @Schema(description = "绩效工资", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "绩效工资不能为空")
    @Min(value = 0, message = "绩效工资最小值为0")
    private BigDecimal performancePay = BigDecimal.ZERO;
    /**
     * 交通补贴（每月固定）
     */
    @Schema(description = "交通补贴", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "交通补贴不能为空")
    @Min(value = 0, message = "交通补贴最小值为0")
    private BigDecimal trafficAllowance = BigDecimal.ZERO;
    /**
     * 通讯补贴（每月固定）
     */
    @Schema(description = "通讯补贴", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "通讯补贴不能为空")
    @Min(value = 0, message = "通讯补贴最小值为0")
    private BigDecimal phoneAllowance = BigDecimal.ZERO;
    /**
     * 餐费补贴（按工作日计算）
     */
    @Schema(description = "餐费补贴", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "餐费补贴不能为空")
    @Min(value = 0, message = "餐费补贴最小值为0")
    private BigDecimal mealAllowance = BigDecimal.ZERO;
    /**
     * 其他补贴（每月固定）
     */
    @Schema(description = "其他补贴", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "其他补贴不能为空")
    @Min(value = 0, message = "其他补贴最小值为0")
    private BigDecimal otherallowance = BigDecimal.ZERO;

    // 社保相关（企业+个人）
    /**
     * 开始缴纳社保日期
     */
    @Schema(description = "开始缴纳社保日期", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "开始缴纳社保日期不能为空")
    private LocalDate socialSecurityDate;
    /**
     * 社保规则ID
     */
    @Schema(description = "社保规则", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "社保规则不能为空")
    private Long socialSecurityRuleId;

    // 公积金相关
    /**
     * 公积金基数
     */
    @Schema(description = "公积金基数", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "公积金基数不能为空")
    @Min(value = 0, message = "公积金基数最小值为0")
    private BigDecimal housingFundBase;
    /**
     * 企业缴存比例
     */
    @Schema(description = "企业缴存比例", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "企业缴存比例不能为空")
    @Range(min = 0, max = 20, message = "企业缴存比例范围在0%-20%之间")
    private BigDecimal housingFundEnterpriseRate;
    /**
     * 个人缴存比例
     */
    @Schema(description = "个人缴存比例", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "个人缴存比例不能为空")
    @Range(min = 0, max = 10, message = "个人缴存比例范围在0%-10%之间")
    private BigDecimal housingFundPersonalRate;


    /**
     * 发薪日
     */
    @Schema(description = "发薪日", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotBlank(message = "发薪日不能为空")
    @Size(max = 20, message = "发薪日不能超过 20 个字符")
    private String paySalaryDay;

}
